//
//  MusicCollectionViewCell.m
//  myMusicApp
//
//  Created by 11_wyq on 15/6/16.
//  Copyright (c) 2015年 lanou3g.com 蓝鸥科技. All rights reserved.
//

#import "MusicCollectionViewCell.h"

@implementation MusicCollectionViewCell

-(instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        [self createSubviews];
    }
    return self;
}
-(void)createSubviews
{

    self.backgroundColor = [UIColor blackColor];
    
    //类型图片
    
    self.myImageView = [[UIImageView alloc]initWithFrame:self.contentView.bounds];
    [self.contentView addSubview:self.myImageView];
    self.myImageView.layer.masksToBounds = YES;//设置圆角边缘
    self.myImageView.layer.cornerRadius = self.contentView.frame.size.height / 2;//设置弧度
    
    
    UIView *view = [[UIView alloc] initWithFrame:self.contentView.bounds];
    view.alpha = 0.2;
    view.backgroundColor = [UIColor blackColor];
    [self.myImageView addSubview:view];
    
    
    //类型
    self.myLabel = [[UILabel alloc]initWithFrame:CGRectMake(self.contentView.bounds.origin.x * WIDTH, (self.contentView.bounds.origin.y + 120) * HEIGHT,110 * WIDTH, 30 * HEIGHT)];
    self.myLabel.textColor = [UIColor whiteColor];
    self.myLabel.backgroundColor = [UIColor clearColor];
    self.myLabel.text = @"类型";
    //设置字体居中
    self.myLabel.textAlignment = NSTextAlignmentCenter;
    [self.contentView addSubview:self.myLabel];
    

}



-(void)setFMModel:(MusicFMModel *)FMModel
{
    if (_FMModel != FMModel) {
        [FMModel release];
        _FMModel  = [FMModel retain];
    }
    
    NSURL *imageUrl = [NSURL URLWithString:_FMModel.cover_path];
    [self.myImageView sd_setImageWithURL:imageUrl placeholderImage:[UIImage imageNamed:@"cell_bg_noData_1@2x.png"]];
  
    self.myLabel.text = self.FMModel.tname;

}


@end
